package ThreadDemo;

public class ThreadDemo11 {
    public static void main(String[] args) throws InterruptedException {
        Object locker = new Object();
        Thread t = new Thread(()->{
            System.out.println("t线程开始");
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("t线程结束");
        });
        t.start();
        t.join();//主线程等待t线程结束
        System.out.println("主线程结束");
    }
}
